<%@page import="com.sun.image.codec.jpeg.JPEGCodec"%>
<%@page import="com.sun.image.codec.jpeg.JPEGImageEncoder"%>
<%@page import="javax.imageio.ImageIO"%>
<%@page import="java.awt.image.BufferedImage"%>
<%@page import="java.io.BufferedInputStream"%>
<%@page import="java.io.OutputStream"%>
<%@page import="java.io.InputStream"%>
<%@page import="cn.com.scau.tstjxt.util.SpringUtil"%>
<%@page import="java.sql.Blob"%>
<%@page import="cn.com.scau.tstjxt.dao.Tbook"%>
<%@page import="cn.com.scau.tstjxt.action.TbookAction"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>    
<%
				 response.reset(); 				 
                 InputStream is = null;    
                 OutputStream os = null;
                 byte[] data = null;
                 BufferedInputStream inputimage=null;
                 String systemid = request.getParameter("systemid");
				 TbookAction tbookAction = (TbookAction)SpringUtil.getBean("TbookAction");
				 Tbook tbook = tbookAction.findTbookbyid(systemid);
				 System.out.println("tbook.getAuthor():"+tbook.getAuthor());
				 Blob cover = tbook.getCover();
				 try{
					 response.setContentType("image/jpeg"); 
					 is = cover.getBinaryStream();  
				     os = response.getOutputStream();    
				     int num;    
				     byte buf[] = new byte[1024];    
				     while((num=is.read(buf))!=-1){    
				        os.write(buf, 0, num);    
				     }    
				     os.flush(); 
				 }catch(Exception ex){ 
                	 ex.printStackTrace();
                 }finally{               	   
    			     is.close();    
    			     os.close();
                 }
%>